home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload Trio 2
/
Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO
/
dir43
/
qsrc_dsk.zip
/
MODEL
/
BUDGET.SPR
< prev
next >
Wrap
Text File
|
1992-01-13
|
23KB
|
693 lines
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ 01/13/92 BUDGET.SPR 23:50:16 ║
* ║ ║
* ╟─────────────────────────────────────────────────────────╢
* ║ ║
* ║ Lisa C. Slater and Steven E. Arnott ║
* ║ ║
* ║ Copyright (c) 1992 ║
* ║ Application developed for _Using FoxPro 2_ ║
* ║ Que Publishing Corporation ║
* ║ ISBN 0-88022-703-6 ║
* ║ ║
* ║ Description: ║
* ║ This program was automatically generated by GENSCRN. ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ BUDGET Setup Code - SECTION 1 ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
#REGION 1
* #REDEFINE generator directive in case
* file has been interactively BROWSEd under
* WIDGET.MPR, which would result in a window
* of the same name already existing because we
* named these windows the same as the files!
* A browse window is named by its title and
* its default title is its ALIAS.
#REGION 0
REGIONAL m.currarea, m.talkstat, m.compstat
IF SET("TALK") = "ON"
SET TALK OFF
m.talkstat = "ON"
ELSE
m.talkstat = "OFF"
ENDIF
m.compstat = SET("COMPATIBLE")
SET COMPATIBLE FOXPLUS
m.currarea = SELECT()
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ S9994048 Databases, Indexes, Relations ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
IF USED("budcat")
SELECT budcat
SET ORDER TO TAG "budcatcode"
ELSE
SELECT 0
USE (LOCFILE("budcat.dbf","DBF","Where is budcat?"));
AGAIN ALIAS budcat ;
ORDER TAG "budcatcode"
ENDIF
IF USED("budget")
SELECT budget
SET ORDER TO 0
ELSE
SELECT 0
USE (LOCFILE("budget.dbf","DBF","Where is budget?"));
AGAIN ALIAS budget ;
ORDER 0
ENDIF
IF USED("product")
SELECT product
SET ORDER TO TAG "prodcode"
ELSE
SELECT 0
USE (LOCFILE("product.dbf","DBF","Where is product?"));
AGAIN ALIAS product ;
ORDER TAG "prodcode"
ENDIF
IF USED("dept")
SELECT dept
SET ORDER TO TAG "deptcode"
ELSE
SELECT 0
USE (LOCFILE("dept.dbf","DBF","Where is dept?"));
AGAIN ALIAS dept ;
ORDER TAG "deptcode"
ENDIF
SELECT budget
SET RELATION OFF INTO budcat
SET RELATION TO budget.budcatcode INTO budcat ADDITIVE
SET RELATION OFF INTO product
SET RELATION TO prodcode INTO product ADDITIVE
SET RELATION OFF INTO dept
SET RELATION TO deptcode INTO dept ADDITIVE
SELECT budget
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ Window definitions ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
DEFINE WINDOW budget ;
FROM 1, 1 ;
TO 18,78 ;
TITLE " Budget Table " ;
FLOAT ;
NOCLOSE ;
SHADOW ;
MINIMIZE ;
COLOR SCHEME 10
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ BUDGET Setup Code - SECTION 2 ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
#REGION 1
old_sys = SET("SYSMENU")
SET SYSMENU AUTOMATIC
SELECT dept
DIMENSION deptarray(RECCOUNT(),2)
COPY TO ARRAY deptarray FIELDS deptname,deptcode ALL
SELECT budcat
DEFINE POPUP budcat FROM 1,28 IN budget ;
TITLE " Pick Category " SCROLL PROMPT FIELD budcat
ON SELECTION POPUP budcat DEACTIVATE POPUP
SELECT budget
SCATTER MEMVAR MEMO
DO CASE
CASE UPPER(ORDER()) = "PERIOD"
m.order = 2
CASE UPPER(ORDER()) = "DEPTCODE"
m.order = 3
CASE UPPER(ORDER()) = "BUDCATCODE"
m.order = 4
OTHERWISE
SET ORDER TO 0
m.order = 1
ENDCASE
m.budcatname =IIF( EMPTY(m.budcatcode),SPACE(20), budcat.budcat)
m.dept = IIF(EMPTY(m.deptcode), ;
0, ASUBSCRIPT("deptarray",ASCAN("deptarray",m.deptcode),1) )
m.product = IIF(EMPTY(m.prodcode), " ", product.prodname)
DEFINE WINDOW brow FROM 20,12 TO SROWS()-2,68 SYSTEM FLOAT GROW ZOOM COLOR SCHEME 10
BROWSE SAVE NOWAIT NOEDIT WINDOW brow PREFERENCE Budgentry;
TITLE " Pick Budget Entry " WHEN Do_Show()
RELEASE WINDOW brow
#REGION 1
DEFINE POPUP _q291f3dqs ;
PROMPT FIELD product.prodname ;
SCROLL ;
MARGIN ;
MARK ""
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ BUDGET Screen Layout ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
#REGION 1
IF WVISIBLE("budget")
ACTIVATE WINDOW budget SAME
ELSE
ACTIVATE WINDOW budget NOSHOW
ENDIF
@ 0,0 TO 10,75
@ 0,28 SAY " Edit this Record "
@ 2,12 SAY "Period:"
@ 4,3 SAY "Budgeted Amount:"
@ 6,3 SAY "Budget Category:"
@ 6,24 TO 6,25
@ 8,24 TO 8,25
@ 6,25 TO 8,25
@ 8,25 SAY "┘"
@ 6,25 SAY "┐"
@ 8,23 TO 8,23 ""
@ 1,55 SAY "Notes:"
@ 11,5 SAY "Order Table By:"
@ 2,20 GET m.period ;
SIZE 1,8 ;
DEFAULT { / / } ;
PICTURE "@K" ;
VALID _q291f3e3y()
@ 4,20 GET m.budgetamt ;
SIZE 1,7 ;
DEFAULT 0 ;
PICTURE "@K$"
@ 6,20 GET m.budcatcode ;
SIZE 1,4 ;
DEFAULT " " ;
PICTURE "@! AAAN" ;
WHEN valbudcat() ;
VALID _q291f3ecw()
@ 8,3 GET m.budcatname ;
SIZE 1,20 ;
DEFAULT " " ;
DISABLE
@ 1,30 GET m.product ;
PICTURE "@&N" ;
POPUP _q291f3dqs ;
SIZE 5,23 ;
DEFAULT " " ;
VALID _q291f3ekw() ;
COLOR SCHEME 9
@ 6,30 GET m.dept ;
PICTURE "@^" ;
FROM deptarray ;
SIZE 3,23 ;
DEFAULT 1 ;
VALID _q291f3esf() ;
COLOR SCHEME 10, 9
@ 2,55 EDIT m.notes ;
SIZE 7,18,180 ;
DEFAULT " " ;
SCROLL
@ 10,28 GET m.final ;
PICTURE "@*C \<Finalize Entry? " ;
SIZE 1,20 ;
DEFAULT 0 ;
VALID _q291f3f19() ;
COLOR SCHEME 4
@ 12,29 GET saveit ;
PICTURE "@*VN \!\<Cancel Edit ; \<Save Changes" ;
SIZE 1,17,1 ;
DEFAULT 1 ;
VALID _q291f3f9g() ;
COLOR SCHEME 8
@ 12,6 GET m.order ;
PICTURE "@*RVN No Order ;Period ;Dept;Category" ;
SIZE 1,13,0 ;
DEFAULT 1 ;
VALID _q291f3fk3()
@ 12,50 GET m.query1 ;
PICTURE "@*IVN " ;
SIZE 1,25,1 ;
DEFAULT 0 ;
VALID _q291f3ftp()
@ 14,50 GET m.query2 ;
PICTURE "@*IVN " ;
SIZE 1,25,1 ;
DEFAULT 0 ;
VALID _q291f3g2a()
@ 12,53 SAY "√ Dept Totals For Pd" ;
SIZE 1,20
@ 14,50 SAY "√ Product Totals For Year" ;
SIZE 1,25
IF NOT WVISIBLE("budget")
ACTIVATE WINDOW budget
ENDIF
READ CYCLE ;
ACTIVATE _q291f3gc2() ;
SHOW _q291f3gc7()
RELEASE WINDOW budget
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ Closing Databases ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
IF USED("budcat")
SELECT budcat
USE
ENDIF
IF USED("budget")
SELECT budget
USE
ENDIF
IF USED("product")
SELECT product
USE
ENDIF
IF USED("dept")
SELECT dept
USE
ENDIF
SELECT (m.currarea)
RELEASE POPUPS _q291f3dqs
#REGION 0
IF m.talkstat = "ON"
SET TALK ON
ENDIF
IF m.compstat = "ON"
SET COMPATIBLE ON
ENDIF
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ BUDGET Cleanup Code ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
#REGION 1
SET SYSMENU &old_sys
RELEASE WINDOW "Pick"
RELEASE POPUP budcat
RELEASE deptarray
RETURN
PROCEDURE no_edit
SHOW GET m.period DISABLE
SHOW GET m.budgetamt DISABLE
SHOW GET m.budcatcode DISABLE
SHOW GET m.product DISABLE
SHOW GET m.dept DISABLE
SHOW GET m.final DISABLE
_CUROBJ = OBJNUM(m.notes)
RETURN
PROCEDURE can_edit
SHOW GET m.period ENABLE
SHOW GET m.budgetamt ENABLE
SHOW GET m.budcatcode ENABLE
SHOW GET m.product ENABLE
SHOW GET m.dept ENABLE
_CUROBJ = OBJNUM(m.period)
DO can_final
RETURN
FUNCTION valbudcat
IF EMPTY(m.budcatcode) OR NOT SEEK(m.budcatcode,"budcat")
ACTIVATE POPUP budcat
SELECT budget
STORE budcat.budcatcode TO m.budcatcode
STORE budcat.budcat TO m.budcatname
SHOW GET m.budcatname DISABLE
ENDIF
RETURN .T.
FUNCTION to_final
mreturn = .F.
IF m.final
DO no_edit
mreturn = .T.
ELSE
IF ! m.final AND ! EMPTY(m.period) AND (m.period < DATE() OR (YEAR(m.period) = YEAR(DATE()) AND pd(m.period) = pd(DATE())))
STORE .T. TO m.final
WAIT WINDOW NOWAIT "Entry in past or present Periods must be Final."
DO no_edit
mreturn = .T.
ENDIF
ENDIF
RETURN mreturn
PROCEDURE can_final
IF EMPTY(m.prodcode) OR EMPTY(m.deptcode) OR EMPTY(m.budcatcode) OR EMPTY(m.period)
SHOW GET m.final DISABLE
ELSE
SHOW GET m.final ENABLE
ENDIF
RETURN
FUNCTION pd
PARAMETERS the_date
RETURN CEILING(MONTH(the_date)/3)
FUNCTION do_show
SHOW GETS
SHOW WINDOW "Pick" REFRESH
RETURN .F.
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ _Q291F3E3Y m.period VALID ║
* ║ ║
* ║ Function Origin: ║
* ║ ║
* ║ From Screen: BUDGET, Record Number: 22 ║
* ║ Variable: m.period ║
* ║ Called By: VALID Clause ║
* ║ Object Type: Field ║
* ║ Snippet Number: 1 ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
FUNCTION _q291f3e3y && m.period VALID
#REGION 1
IF ! to_final()
DO can_final
ENDIF
RETURN .T.
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ _Q291F3ECW m.budcatcode VALID ║
* ║ ║
* ║ Function Origin: ║
* ║ ║
* ║ From Screen: BUDGET, Record Number: 24 ║
* ║ Variable: m.budcatcode ║
* ║ Called By: VALID Clause ║
* ║ Object Type: Field ║
* ║ Snippet Number: 2 ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
FUNCTION _q291f3ecw && m.budcatcode VALID
#REGION 1
=valbudcat()
DO can_final
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ _Q291F3EKW m.product VALID ║
* ║ ║
* ║ Function Origin: ║
* ║ ║
* ║ From Screen: BUDGET, Record Number: 26 ║
* ║ Variable: m.product ║
* ║ Called By: VALID Clause ║
* ║ Object Type: List ║
* ║ Snippet Number: 3 ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
FUNCTION _q291f3ekw && m.product VALID
#REGION 1
IF ! EMPTY(m.product)
STORE product.prodcode TO m.prodcode
DO can_final
ENDIF
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ _Q291F3ESF m.dept VALID ║
* ║ ║
* ║ Function Origin: ║
* ║ ║
* ║ From Screen: BUDGET, Record Number: 27 ║
* ║ Variable: m.dept ║
* ║ Called By: VALID Clause ║
* ║ Object Type: Popup ║
* ║ Snippet Number: 4 ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
FUNCTION _q291f3esf && m.dept VALID
#REGION 1
IF ! EMPTY(m.dept)
STORE deptarray(m.dept,2) ;
TO m.deptcode
DO can_final
ENDIF
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ _Q291F3F19 m.final VALID ║
* ║ ║
* ║ Function Origin: ║
* ║ ║
* ║ From Screen: BUDGET, Record Number: 29 ║
* ║ Variable: m.final ║
* ║ Called By: VALID Clause ║
* ║ Object Type: Check Box ║
* ║ Snippet Number: 5 ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
FUNCTION _q291f3f19 && m.final VALID
#REGION 1
IF m.final
WAIT WINDOW " Finalized Budget Entries are not editable. " NOWAIT
DO no_edit
ENDIF
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ _Q291F3F9G saveit VALID ║
* ║ ║
* ║ Function Origin: ║
* ║ ║
* ║ From Screen: BUDGET, Record Number: 30 ║
* ║ Variable: saveit ║
* ║ Called By: VALID Clause ║
* ║ Object Type: Push Button ║
* ║ Snippet Number: 6 ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
FUNCTION _q291f3f9g && saveit VALID
#REGION 1
mreturn = .T.
IF saveit = 2
IF EMPTY(m.deptcode) OR EMPTY(m.budcatcode) OR EMPTY(m.period) OR EMPTY(m.prodcode)
WAIT WINDOW " Fill out all information before Saving, or Cancel Edit " NOWAIT
mreturn = .F.
ELSE
GATHER MEMVAR MEMO
SHOW GETS
ENDIF
ELSE
WAIT WINDOW " Editing Cancelled " NOWAIT
SHOW GETS
ENDIF
RETURN mreturn
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ _Q291F3FK3 m.order VALID ║
* ║ ║
* ║ Function Origin: ║
* ║ ║
* ║ From Screen: BUDGET, Record Number: 31 ║
* ║ Variable: m.order ║
* ║ Called By: VALID Clause ║
* ║ Object Type: Radio Button ║
* ║ Snippet Number: 7 ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
FUNCTION _q291f3fk3 && m.order VALID
#REGION 1
DO CASE
CASE m.order = 1
SET ORDER TO 0
CASE m.order = 2
SET ORDER TO period
CASE m.order = 3
SET ORDER TO deptcode
CASE m.order = 4
SET ORDER TO budcatcode
ENDCASE
SHOW WINDOW Pick REFRESH
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ _Q291F3FTP m.query1 VALID ║
* ║ ║
* ║ Function Origin: ║
* ║ ║
* ║ From Screen: BUDGET, Record Number: 32 ║
* ║ Variable: m.query1 ║
* ║ Called By: VALID Clause ║
* ║ Snippet Number: 8 ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
FUNCTION _q291f3ftp && m.query1 VALID
#REGION 1
DO budget1.qpr
* output to a cursor
BROWSE
* couldn't set up the BROWSE
* in the QPR because it
* will set up a preference
* by the name of the cursor
* that it invents,
* which is BUDGET_A -- this
* preference is then invalid
* for the other query button
SELECT budget
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ _Q291F3G2A m.query2 VALID ║
* ║ ║
* ║ Function Origin: ║
* ║ ║
* ║ From Screen: BUDGET, Record Number: 33 ║
* ║ Variable: m.query2 ║
* ║ Called By: VALID Clause ║
* ║ Snippet Number: 9 ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
FUNCTION _q291f3g2a && m.query2 VALID
#REGION 1
DO budget2.qpr
* output to a cursor
BROWSE
* couldn't set up the BROWSE
* in the QPR because it
* will set up a preference
* by the name of the cursor
* that it invents,
* which is BUDGET_A -- this
* preference is then invalid
* for the other query button
SELECT budget
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ _Q291F3GC2 Read Level Activate ║
* ║ ║
* ║ Function Origin: ║
* ║ ║
* ║ From Screen: BUDGET ║
* ║ Called By: READ Statement ║
* ║ Snippet Number: 10 ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
FUNCTION _q291f3gc2 && Read Level Activate
*
* Activate Code from screen: BUDGET
*
#REGION 1
IF ! WVISIBLE("Pick")
CLEAR READ
ENDIF
* ╓─────────────────────────────────────────────────────────╖
* ║ ║
* ║ _Q291F3GC7 Read Level Show ║
* ║ ║
* ║ Function Origin: ║
* ║ ║
* ║ From Screen: BUDGET ║
* ║ Called By: READ Statement ║
* ║ Snippet Number: 11 ║
* ║ ║
* ╙─────────────────────────────────────────────────────────╜
*
FUNCTION _q291f3gc7 && Read Level Show
PRIVATE currwind
STORE WOUTPUT() TO currwind
*
* Show Code from screen: BUDGET
*
#REGION 1
IF ! budget.final AND ! EMPTY(budget.period) AND (budget.period < DATE() OR (YEAR(budget.period) = YEAR(DATE()) AND pd(budget.period) = pd(DATE())))
REPLACE budget.final WITH .T.
WAIT WINDOW NOWAIT "Entry in past or present Periods must be Final."
ENDIF
SCATTER MEMVAR MEMO
m.budcatname =IIF( EMPTY(m.budcatcode),SPACE(20), budcat.budcat)
m.dept = IIF(EMPTY(m.deptcode), ;
0, ASUBSCRIPT("deptarray",ASCAN("deptarray",m.deptcode),1))
m.product = IIF(EMPTY(m.prodcode), " ", product.prodname)
IF m.final
DO no_edit
ELSE
DO can_edit
ENDIF
IF SYS(2016) = "BUDGET" OR SYS(2016) = "*"
ACTIVATE WINDOW budget SAME
@ 12,53 SAY "√ Dept Totals For Pd" ;
SIZE 1,20
@ 14,50 SAY "√ Product Totals For Year" ;
SIZE 1,25
ENDIF
IF NOT EMPTY(currwind)
ACTIVATE WINDOW (currwind) SAME
ENDIF